Creating reference objects

ABSTRACT

A storage medium and computer system that, in an embodiment, in response to a request to create a target object, create a reference object for the target object and bind the reference object to a name space without the target object being instantiated. In response to an invocation of a method on the reference object, a determination is made whether a target object associated with the reference object exists. If the target object does not already exist, the target object is instantiated. If the target object does already exist, the target object is returned. In this way, target objects are not instantiated until a method on the reference object is invoked, which in an embodiment increases the performance of the invoking application.

CROSS REFERENCE TO RELATED APPLICATION

This is a continuation application of U.S. patent application Ser. No.10/977,769, filed Oct. 29, 2004, entitled “Creating Reference Objects,”which is herein incorporated by reference.

FIELD

An embodiment of the invention generally relates to computers. Inparticular, an embodiment of the invention generally relates to creatingreference objects in a name space.

BACKGROUND

The development of the EDVAC computer system of 1948 is often cited asthe beginning of the computer era. Since that time, computer systemshave evolved into extremely sophisticated devices, and computer systemsmay be found in many different settings. Computer systems typicallyinclude a combination of hardware, such as semiconductors and circuitboards, and software, also known as computer programs. As advances insemiconductor processing and computer architecture push the performanceof the computer hardware higher, more sophisticated and complex computersoftware has evolved to take advantage of the higher performance of thehardware, resulting in computer systems today that are much morepowerful than just a few years ago.

Years ago, computers were isolated devices that did not communicate witheach other. But, today computers are often connected in networks, suchas the Internet or World Wide Web, and a user at one computer, oftencalled a client, may wish to access information at multiple othercomputers, often called servers, via a network. Accessing and usinginformation from multiple computers is often called distributedcomputing. Since these multiple computers may be using differentsoftware that runs on different hardware, distributing computing is achallenging and complex environment.

One way to address the difficult problems of distributed computing is touse the Enterprise JavaBeans (EJB) specification, which provides forcreating server-side scalable, transactional, multi-user, secureenterprise-level applications. The Enterprise JavaBeans specificationprovides a consistent component architecture framework for creatingdistributed applications.

According to the EJB specification, Enterprise Beans are building blocksthat either can be used alone or with other enterprise beans to buildcomplete, robust, thin-client multi-tiered applications. An EJB is abody of code with fields and methods to implement modules of businesslogic. An EJB can either be transient or persistent.

When an EJB application needs to use the services of an enterprise Bean,it creates the EJB through its Home interface. The applicationspecifically uses one of the multiple create( ) methods that the Homeinterface defines. The implementation of the Home interface is donethrough an object called the Home object. An instance of this Homeobject is created within the server and is made available to theapplication as a factory for creating the enterprise Bean.

When an EJB application is started, a reference object for the EJB Homeobject corresponding to each type of EJB within the application must beplaced (bound) into a data structure called a name space, which makes itavailable for lookup operations from users of that type of EJB. Areference object is a type of pointer object that is used to gain accessto an associated target object, which in this example is the Homeobject. Referencing the Home object requires that the actual targetobject of that type be loaded and instantiated in the application serverand then registered with the Object Request Broker (ORB), which in turncreates the reference object.

Since a large EJB application may include hundreds of EJB types, only aportion of which might actually be used during the execution of theapplication, loading and instantiating each one of the hundreds of theEJB types at application startup can cause performance degradation ofthe EJB application.

Without a better way to handle references to objects, users willcontinue to suffer from degraded performance. Although theaforementioned problems have been described in the context of EnterpriseJavaBeans and Home objects, they may occur in the CORBA (Common ObjectRequest Broker Architecture) environment or any other appropriatecontext, and they may occur for any appropriate type of target object.

SUMMARY

A storage medium and computer system are provided that, in anembodiment, in response to a request to create a target object, create areference object for the target object and bind the reference object toa name space without the target object being instantiated. In responseto an invocation of a method on the reference object, a determination ismade whether a target object associated with the reference objectexists. If the target object does not already exist, the target objectis instantiated. If the target object does already exist, the targetobject is returned. In this way, target objects are not instantiateduntil a method on the reference object is invoked, which in anembodiment increases the performance of the invoking application.

BRIEF DESCRIPTION OF THE DRAWING

FIG. 1 depicts a block diagram of an example system for implementing anembodiment of the invention.

FIG. 2 depicts a block diagram of an example data structure for a namespace, according to an embodiment of the invention.

FIG. 3 depicts a flowchart of example processing for creating areference object and binding the reference object to the name space,according to an embodiment of the invention.

FIG. 4 depicts a flowchart of example processing for accessing thereference object via a method, according to an embodiment of theinvention.

DETAILED DESCRIPTION

Referring to the Drawing, wherein like numbers denote like partsthroughout the several views, FIG. 1 depicts a high-level block diagramrepresentation of a computer system 100, operating as a server,connected to a client 132 via a network 130, according to an embodimentof the present invention. The major components of the computer system100 include one or more processors 101, a main memory 102, a terminalinterface 111, a storage interface 112, an I/O (Input/Output) deviceinterface 113, and communications/network interfaces 114, all of whichare coupled for inter-component communication via a memory bus 103, anI/O bus 104, and an I/O bus interface unit 105.

The computer system 100 contains one or more general-purposeprogrammable central processing units (CPUs) 101A, 101B, 101C, and 101D,herein generically referred to as the processor 101. In an embodiment,the computer system 100 contains multiple processors typical of arelatively large system; however, in another embodiment the computersystem 100 may alternatively be a single CPU system. Each processor 101executes instructions stored in the main memory 102 and may include oneor more levels of on-board cache.

The main memory 102 is a random-access semiconductor memory for storingdata and programs. The main memory 102 is conceptually a singlemonolithic entity, but in other embodiments the main memory 102 is amore complex arrangement, such as a hierarchy of caches and other memorydevices. For example, memory may exist in multiple levels of caches, andthese caches may be further divided by function, so that one cache holdsinstructions while another holds non-instruction data, which is used bythe processor or processors. Memory may be further distributed andassociated with different CPUs or sets of CPUs, as is known in any ofvarious so-called non-uniform memory access (NUMA) computerarchitectures.

The memory 102 includes a server implementation 150, a name space 152,an object request broker 154, a reference object 156, and a targetobject 158. Although the server implementation 150, the name space 152,the object request broker 154, the reference object 156, and the targetobject 158 are illustrated as being contained within the memory 102 inthe computer system 100, in other embodiments some or all of them may beon different computer systems and may be accessed remotely, e.g., viathe network 130. The computer system 100 may use virtual addressingmechanisms that allow the programs of the computer system 100 to behaveas if they only have access to a large, single storage entity instead ofaccess to multiple, smaller storage entities. Thus, while the serverimplementation 150, the name space 152, the object request broker 154,the reference object 156, and the target object 158 are illustrated asbeing contained within the main memory 102, these elements are notnecessarily all completely contained in the same storage device at thesame time. Further, although the server implementation 150, the namespace 152, the object request broker 154, the reference object 156, andthe target object 158 are illustrated as being separate entities, inother embodiments some of them, or portions of some of them, may bepackaged together.

The server implementation 150 uses the name of the target object 158 andinformation regarding the target object 158 to create the referenceobject 156 and binds the reference object 156 to the name space 152. Anobject is a discrete entity that provides the operations defined in itsinterface and includes a method or methods and encapsulated data. Anobject is instantiated from a class definition. The name space 152includes the names of the target objects 158 and pointers to therespective reference objects 156 that are associated with the namedtarget objects 158. The name space 152 is further described below withreference to FIG. 2. Applications use the reference objects 156 toinvoke methods against the respective target objects 158 via the objectrequest broker 154 and the name space 152. In an embodiment, the targetobject 158 is an EJB Home object, but in other embodiments anyappropriate target object may be used.

In an embodiment, the server implementation 150 is an EJB container, butin other embodiments any appropriate implementation may be used. In anembodiment, the server implementation 150 includes instructions capableof executing on the processor 101 or statements capable of beinginterpreted by instructions executing on the processor 101 to performthe functions as further described below with reference to FIGS. 3 and4. In another embodiment, the server implementation 150 may beimplemented in microcode. In another embodiment, the serverimplementation 150 may be implemented in hardware via logic gates and/orother appropriate hardware techniques.

The memory bus 103 provides a data communication path for transferringdata among the processor 101, the main memory 102, and the I/O businterface unit 105. The I/O bus interface unit 105 is further coupled tothe system I/O bus 104 for transferring data to and from the various I/Ounits. The I/O bus interface unit 105 communicates with multiple I/Ointerface units 111, 112, 113, and 114, which are also known as I/Oprocessors (IOPs) or I/O adapters (IOAs), through the system I/O bus104. The system I/O bus 104 may be, e.g., an industry standard PCI bus,or any other appropriate bus technology.

The I/O interface units support communication with a variety of storageand I/O devices. For example, the terminal interface unit 111 supportsthe attachment of one or more user terminals 121; 122, 123, and 124. Thestorage interface unit 112 supports the attachment of one or more directaccess storage devices (DASD) 125, 126, and 127 (which are typicallyrotating magnetic disk drive storage devices, although they couldalternatively be other devices, including arrays of disk drivesconfigured to appear as a single large storage device to a host). Thecontents of the main memory 102 may be stored to and retrieved from thedirect access storage devices 125, 126, and 127.

The I/O and other device interface 113 provides an interface to any ofvarious other input/output devices or devices of other types. Two suchdevices, the printer 128 and the fax machine 129, are shown in theexemplary embodiment of FIG. 1, but in other embodiment many other suchdevices may exist, which may be of differing types. The networkinterface 114 provides one or more communications paths from thecomputer system 100 to other digital devices and computer systems; suchpaths may include, e.g., one or more networks 130.

Although the memory bus 103 is shown in FIG. 1 as a relatively simple,single bus structure providing a direct communication path among theprocessors 101, the main memory 102, and the I/O bus interface 105, infact the memory bus 103 may comprise multiple different buses orcommunication paths, which may be arranged in any of various forms, suchas point-to-point links in hierarchical, star or web configurations,multiple hierarchical buses, parallel and redundant paths, etc.Furthermore, while the I/O bus interface 105 and the I/O bus 104 areshown as single respective units, the computer system 100 may in factcontain multiple I/O bus interface units 105 and/or multiple I/O buses104. While multiple I/O interface units are shown, which separate thesystem I/O bus 104 from various communications paths running to thevarious I/O devices, in other embodiments some or all of the I/O devicesare connected directly to one or more system I/O buses.

The computer system 100 depicted in FIG. 1 has multiple attachedterminals 121, 122, 123, and 124, such as might be typical of amulti-user “mainframe” computer system. Typically, in such a case theactual number of attached devices is greater than those shown in FIG. 1,although the present invention is not limited to systems of anyparticular size. The computer system 100 may alternatively be asingle-user system, typically containing only a single user display andkeyboard input, or might be a server or similar device which has littleor no direct user interface, but receives requests from other computersystems (clients). In other embodiments, the computer system 100 may beimplemented as a personal computer, portable computer, laptop ornotebook computer, PDA (Personal Digital Assistant), tablet computer,pocket computer, telephone, pager, automobile, teleconferencing system,appliance, or any other appropriate type of electronic device.

The network 130 may be any suitable network or combination of networksand may support any appropriate protocol suitable for communication ofdata and/or code to/from the computer system 100. In variousembodiments, the network 130 may represent a storage device or acombination of storage devices, either connected directly or indirectlyto the computer system 100. In an embodiment, the network 130 maysupport the Infiniband architecture. In another embodiment, the network130 may support wireless communications. In another embodiment, thenetwork 130 may support hard-wired communications, such as a telephoneline or cable. In another embodiment, the network 130 may support theEthernet IEEE (Institute of Electrical and Electronics Engineers) 802.3xspecification. In another embodiment, the network 130 may be theInternet and may support IP (Internet Protocol). In another embodiment,the network 130 may be a local area network (LAN) or a wide area network(WAN). In another embodiment, the network 130 may be a hotspot serviceprovider network. In another embodiment, the network 130 may be anintranet. In another embodiment, the network 130 may be a GPRS (GeneralPacket Radio Service) network. In another embodiment, the network 130may be a FRS (Family Radio Service) network. In another embodiment, thenetwork 130 may be any appropriate cellular data network or cell-basedradio network technology. In another embodiment, the network 130 may bean IEEE 802.11B wireless network. In still another embodiment, thenetwork 130 may be any suitable network or combination of networks.Although one network 130 is shown, in other embodiments any number(including zero) of networks (of the same or different types) may bepresent.

The client 132 includes an application 135, which sends requests to theserver implementation 150. The client 132 may also include any or all ofthe hardware and/or software elements previously described above for thecomputer system 100. Although only one client 132 and one application135 are illustrated in FIG. 1, in other embodiments any number ofclients 132 and any number of applications 135 may be present. Inanother embodiment, the application 135 is present at the server 100,and the client 132 is not present, optional, or not used.

It should be understood that FIG. 1 is intended to depict therepresentative major components of the computer system 100, the network130, and the client 132 at a high level, that individual components mayhave greater complexity than that represented in FIG. 1, that componentsother than or in addition to those shown in FIG. 1 may be present, andthat the number, type, and configuration of such components may vary.Several particular examples of such additional complexity or additionalvariations are disclosed herein; it being understood that these are byway of example only and are not necessarily the only such variations.

The various software components illustrated in FIG. 1 and implementingvarious embodiments of the invention may be implemented in a number ofmanners, including using various computer software applications,routines, components, programs, objects, modules, data structures, etc.,referred to hereinafter as “computer programs,” or simply “programs.”The computer programs typically comprise one or more instructions thatare resident at various times in various memory and storage devices inthe computer system 100, and that, when read and executed by one or moreprocessors 101 in the computer system 100, cause the computer system 100to perform the steps necessary to execute steps or elements comprisingthe various aspects of an embodiment of the invention.

Moreover, while embodiments of the invention have and hereinafter willbe described in the context of fully functioning computer systems, thevarious embodiments of the invention are capable of being distributed asa program product in a variety of forms, and the invention appliesequally regardless of the particular type of signal-bearing medium usedto actually carry out the distribution. The programs defining thefunctions of this embodiment may be delivered to the computer system 100via a variety of signal-bearing media, which include, but are notlimited to:

(1) information permanently stored on a non-rewriteable storage medium,e.g., a read-only memory device attached to or within a computer system,such as a CD-ROM, DVD-R, or DVD+R;

(2) alterable information stored on a rewriteable storage medium, e.g.,a hard disk drive (e.g., the DASD 125, 126, or 127), CD-RW, DVD-RW,DVD+RW, DVD-RAM, or diskette; or

(3) information conveyed by a communications medium, such as through acomputer or a telephone network, e.g., the network 130, includingwireless communications.

Such signal-bearing media, when carrying machine-readable instructionsthat direct the functions of the present invention, representembodiments of the present invention.

In addition, various programs described hereinafter may be identifiedbased upon the application for which they are implemented in a specificembodiment of the invention. But, any particular program nomenclaturethat follows is used merely for convenience, and thus embodiments of theinvention should not be limited to use solely in any specificapplication identified and/or implied by such nomenclature.

The exemplary environments illustrated in FIG. 1 are not intended tolimit the present invention. Indeed, other alternative hardware and/orsoftware environments may be used without departing from the scope ofthe invention.

FIG. 2 depicts a block diagram of an example data structure for the namespace 152, according to an embodiment of the invention. The name space152 includes records 205 and 210, but in other embodiments any number ofrecords with any appropriate data may be present. Each of the records205 and 210 includes a name of a target object field 215 and a pointerto a reference object field 220. The name of the target object field 215includes the name of the target object 158, and the pointer to referenceobject field 220 includes a pointer to the associated reference object156, which is an address in the main memory 102, or in anotherembodiment the pointer to the associated reference object field 220contains a virtual memory address. For example, in the record 205, thename of the target object field 215 includes “target object a,” and thepointer to the associated reference object field 220 contains“C022AF34.” As a further example, in the record 210, the name of thetarget object field 215 includes “target object b,” and the pointer tothe associated reference object 220 field contains “C053AD2A.” Therecords 205 and 210 in the name space 152 are used by the serverimplementation 150 and the application 135, as further described belowwith reference to FIGS. 3 and 4.

FIG. 3 depicts a flowchart of example processing for creating thereference object 156 and binding the reference object 156 to the namespace 152 without instantiating the target object 158, according to anembodiment of the invention.

Control begins at block 300. Control then continues to block 305 wherethe application 135 starts. Control then continues to block 310, whereas part of a startup routine, the application 135 requests the serverimplementation 150 to create the target object 158 and passes the nameof the target object 158 and target object information to the serverimplementation 150. In an embodiment, the target object information mayinclude a name or other identifier of the client 132, an address (e.g.an IP address, a TCP/IP address, or any other appropriate address) thatthe application 135 uses to access the network 130, a port number thatthe application 135 uses to access the network 130, and/or any otherappropriate information related to the target object 158, the client132, and/or the application 135.

Control then continues to block 315 where the server implementation 150uses the target object name and the target object information to createthe reference object 156. Control then continues to block 320 where theserver implementation 150 binds the newly-created reference object 156to the name space 152 by creating a new record in the name space 152(such as the record 205 or 210), saving the name of the target object158 that was passed from application 135 in the name of the targetobject field 215, and saving the pointer to the newly-created referenceobject 156 in the pointer to the reference object field 220. Thereference object 156 is now associated with the application 135. Controlthen continues to block 399 where the logic of FIG. 3 returns.

FIG. 4 depicts a flowchart of example processing for accessing thereference object 156 by a method in the application 135, according to anembodiment of the invention. Control begins at block 400. Control thencontinues to block 405 where the application 135 invokes a method on thereference object 156. Control then continues to block 410 where theapplication 135 looks for a record (e.g., the record 205 or 210)associated with the target object 158 in the name space 152 using thename of the target object 158 as an index into the name space 152 viathe name of the target object field 215. Control then continues to block415 where, in response to the method being invoked against the referenceobject 156, the reference object 156 calls the object request broker154.

Control then continues to block 420 where the request broker 154requests the server implementation 150 for the target object 158 thatcorresponds to the reference object 156. Control then continues to block425 where the server implementation 150 determines whether a targetobject 158 exists that is associated with the reference object 156. Ifthe determination at block 425 is false, then an associated targetobject 158 does not exist, so control continues to block 430 where theserver implementation 150 creates an instance of the target object 158(instantiates the target object 158) that is associated with thereference object 156. Control then continues to block 435 where theserver implementation 150 passes the newly-instantiated target object158 back to the object request broker 154, which passes thenewly-instantiated target object 158 back to the invoking method in theapplication 135. Control then continues to block 499 where the logic ofFIG. 4 returns.

If the determination at block 425 is true, then the associated targetobject 158 does already exist, so control continues to block 435 wherethe server implementation 150 passes the pre-existing target object 158back to the object request broker 154, which passes the target object158 back to the invoking method in the application 135. Control thencontinues to block 499 where the logic of FIG. 4 returns.

In the previous detailed description of exemplary embodiments of theinvention, reference was made to the accompanying drawings (where likenumbers represent like elements), which form a part hereof, and in whichis shown by way of illustration specific exemplary embodiments in whichthe invention may be practiced. These embodiments were described insufficient detail to enable those skilled in the art to practice theinvention, but other embodiments may be utilized and logical,mechanical, electrical, and other changes may be made without departingfrom the scope of the present invention. Different instances of the word“embodiment” as used within this specification do not necessarily referto the same embodiment, but they may. The previous detailed descriptionis, therefore, not to be taken in a limiting sense, and the scope of thepresent invention is defined only by the appended claims.

In the previous description, numerous specific details were set forth toprovide a thorough understanding of the invention. But, the inventionmay be practiced without these specific details. In other instances,well-known circuits, structures, and techniques have not been shown indetail in order not to obscure the invention.

1. A storage medium encoded with instructions, wherein the instructionswhen executed comprise: receiving a request comprising a target objectname and a target object information to create a target object from aclient; in response to the request from the client to create the targetobject, creating a reference object from a class definition at a server,wherein the target object and the reference object are separate; inresponse to the creating the reference object, binding the referenceobject to a name space at the server, wherein the binding the referenceobject to the name space at the server is performed while the targetobject associated with the reference object is not instantiated, whereinthe binding the reference object to the name space at the server whilethe target object associated with the reference object is notinstantiated further comprises saving the target object name and apointer in the name space, wherein the pointer is associated with thetarget object name, and wherein the pointer points to the referenceobject; in response to an invocation of a method at the client on thereference object, determining whether the target object associated withthe reference object exists, wherein the client searches for the targetobject name and the pointer to the reference object in the name spaceusing the target object name as an index into the name space; if thetarget object does not exist, creating an instance of the target objectand returning the instance of the target object to the method that wasinvoked on the reference object in response to the determining, whereinthe target object comprises a home object; and if the target object doesexist, returning the target object to the method that was invoked on thereference object in response to the determining.
 2. The storage mediumof claim 1, wherein the creating the reference object further comprises:creating the reference object based on the target object name and thetarget object information.
 3. The storage medium of claim 2, furthercomprising: returning the target object to an object request broker. 4.The storage medium of claim 1, wherein the target object informationcomprises an identifier of an IP address of the client.
 5. The storagemedium of claim 1, wherein the target object information comprises aport number that the client uses to access a network.
 6. A computersystem comprising: a processor; and a memory connected to the processor,wherein the memory is encoded with instructions, and wherein theinstructions when executed on the processor comprise: receiving arequest comprising a target object name and a target object informationto create a target object from a client, in response to the request fromthe client to create the target object, creating a reference object froma class definition at the computer system, wherein the target object andthe reference object are separate, in response to the creating thereference object, binding the reference object to a name space at thecomputer system, wherein the binding the reference object to the namespace at the computer system is performed while the target objectassociated with the reference object is not instantiated, wherein thebinding the reference object to the name space at the computer systemwhile the target object associated with the reference object is notinstantiated further comprises saving the target object name and apointer in the name space, wherein the pointer is associated with thetarget object name, and wherein the pointer points to the referenceobject, in response to an invocation of a method at the client on thereference object, determining whether the target object associated withthe reference object exists, wherein the client searches for the targetobject name and the pointer to the reference object in the name spaceusing the target object name as an index into the name space, if thetarget object does not exist, creating an instance of the target objectand returning the instance of the target object to the method that wasinvoked on the reference object in response to the determining, whereinthe target object comprises a home object, and if the target object doesexist, returning the target object to the method that was invoked on thereference object in response to the determining.
 7. The computer systemof claim 6, wherein the creating the reference object further comprises:creating the reference object based on the target object name and thetarget object information.
 8. The computer system of claim 7, whereinthe instructions further comprise: returning the target object to anobject request broker.
 9. The computer system of claim 6, wherein thetarget object information comprises an identifier of an IP address ofthe client.
 10. The computer system of claim 6, wherein the targetobject information comprises a port number that the client uses toaccess a network.